// pages/activityinfo/index.js
var app = getApp(), fetchApi = require("../../../../utils/httpPost.js");
Page({
  /**
   * 页面的初始数据
   */
  data: {
    activity: [],
    is_has_activity: 0,
    roles: [],
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.onHttpInit()
  },
  onHttpInit: function () {
    var that = this
    fetchApi.httpPost('/activity/lotteryInfo', {}, function (res) {
      console.log("获取抽奖活动数据", res)
      if (res.data.code == 0) {
        that.setData({
          is_has_activity: res.data.data.is_has_activity,
          roles: res.data.data.activity.roleInfos,
          activity: res.data.data.is_has_activity == 1 ? res.data.data.activity : []
        })
      }
    }, function () { })
  }
})